package first.group.ssh.mac;

import java.security.NoSuchAlgorithmException;
import javax.crypto.Mac;

public final class HmacSha256 extends MacAlgorithm {

    @Override
    public String getName() {
        return "hmac-sha2-256";
    }

    @Override
    public Mac newMac() {
        try {
            return Mac.getInstance("HmacSHA256");
        } catch (NoSuchAlgorithmException ex) {
            throw new RuntimeException(ex);
        }
    }

    @Override
    public int keyLength() {
        return 32;
    }

    @Override
    public int digestLength() {
        return 32;
    }
}
